/**
 * 
 */
package org.istt.domain;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * @author Huy
 *
 */
@Entity
@Table(name = "TBL_DOCUMENT_TYPE", schema = "dbo", catalog = "onegate",uniqueConstraints=
	@UniqueConstraint(columnNames={"name"}))
public class DocumentType extends BaseObject<Long> implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1392103101254166475L;
	private Long id;
    private String name;
    private String code;
    
 // Property accessors
    @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="ID", unique=true, nullable=false)

    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="NAME")

    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof Workflow)) return false;

		final Workflow ps = (Workflow) o;


        if (!getName().equals(ps.getName())) return false;

		return true;
	}

	public int hashCode() {
		int result;
		result = name.hashCode();
		result = 29 * result;
		return result;
	}

	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE)
        .append("name", this.name);

		return sb.toString();
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name="CODE")
	public String getCode() {
		return code;
	}
}
